package ex03;

import java.util.Scanner;

public class Program {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String word = scan.next();
        int num = 0;
        int counter = 1;
        int minNum = 10;
        int currNum = 0;
        long arMins = 0;
        long arRevMins = 0;
        int item = 0;
        boolean isError = false;
        while (word.equals("Week") && !isError) {
            num = scan.nextInt();
            if (counter == num) {
                for (int i = 0; i < 5; i++) {
                    currNum = scan.nextInt();
                    if ((currNum >= 1) && (currNum <= 9)) {
                        if (currNum < minNum) {
                            minNum = currNum;
                        }
                    }
                }
                arMins *= 10;
                arMins += minNum;
                word = scan.next();
            } else {
                isError = true;
            }
            minNum = 10;
            currNum = 0;
            counter++;
        }
        if (word.equals("42")) {
            //arMins /= 10;
        } else if (isError) {
            System.err.println("IllegalArgument");
            System.exit(-1);
        }
        // Переворачиваем число
        for (int i = 1; i < counter; i++) {
            item += arMins % 10;
            arMins /= 10;
            arRevMins *= 10;
            arRevMins += item;
            item = 0;
        }
        // Выводим результат
        for (int i = 1; i < counter; i++) {
            item += arRevMins % 10;
            arRevMins /= 10;
            System.out.print("Week " + i + " ");
            for (int j = 0; j < item; j++) {
                System.out.print("=");
            }
            System.out.println(">");
            item = 0;
        }
    }
}
